<?php session_start();?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <LINK REL=StyleSheet HREF="maintenancePagesCSS.css" TYPE="text/css" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>

        <center>
  <table width="1000" height="606" border="0" background="images/background.jpg">
          <tr>
            <th height="417" scope="col"><p><img src="images/TitleUpdateExistingUser.gif" alt="Update Existing User" width="514" height="67"></p>
              <p>
                <?php
            include "EmployeeDao.php";
            include "Datasource.php";
            $objEmployeeDAO = new EmployeeDao();
            $objDatasource = new Datasource("localhost", "theanykey", "root", "");

            include "Employee.php";
            $objEmployee = new Employee();
            $objEmployee->setFirstName($_POST['txtEmployeeFirstName']);
            $objEmployee->setLastName($_POST['txtEmployeeLastName']);
            $objEmployee->setLoginID($_POST['txtLoginID']);

            if($_POST['txtEmployeePwd'])
            {
                $objEmployee->setPassword($_POST['txtEmployeePwd']);
            }
            else
            {
                $objEmployee->setPassword(null);
            }
            $objEmployee->setRole($_POST['selRole']);
            $objEmployee->setEmpID($_POST['PK']);

            $txtEmployeeLastName = $_POST['txtEmployeeLastName'];

            if($objEmployeeDAO->save(&$objDatasource, &$objEmployee))
            {
                print("<div class='SelectTable'><font style='color: WHITE;'><B>RECORD FOR:</B><br/><table>");
                $lastName = $objEmployee->getLastName();
                $firstName = $objEmployee->getFirstName();
                $loginID = $objEmployee->getLoginID();
                $pw = $objEmployee->getPassword();
                $role = $objEmployee->getRole();
                print("<tr><td align='right'>Last Name:&nbsp;</td><td> $lastName </td></tr>");
                print("<tr><td align='right'>First Name:&nbsp;</td><td> $firstName</td></tr>");
                print("<tr><td align='right'>Logid ID:&nbsp;</td><td> $loginID</td></tr>");
                if($objEmployee->getPassword() != null)
                {
                    print("<tr><td align='right'>PW:&nbsp;</td><td>");
                    for($i = 0; $i < strlen($pw); $i++)
                    {
                        print("*");
                    }
                    print("<br/>");
                }
				print("</td></tr>");
                print("<tr><td align='right'>Role: &nbsp;</td><td>$role </td></tr></table>");
                print("<U>Employee has been successfully updated.</U></font>");
            }
            else
            {
                print("<font style='color: Red'>");
                print("There was an error updating the Employee Record.<br/>Please Try Again<br/>");
                print("</font>");

            }
			            print " </div>";
        ?>
                </p>
                <br/>     
                <BR>
                <BR>
                    <script src="links.js" language="javascript" type="text/javascript"></script>
                    <script type="text/javascript">
            writeEmployeeLinks("SelectEmployee.php", "Edit Another User");
                  </script>
              </p></th>
          </tr>
          <tr>
            <th height="183" scope="col">&nbsp;</th>
          </tr>
        </table>
        <br/>

  
        </center>
    </body>
</html>
